package com.brainhealth.customer.service.impl;

import java.util.List;
import com.brainhealth.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.brainhealth.customer.mapper.RoomChatRecordMapper;
import com.brainhealth.customer.domain.RoomChatRecord;
import com.brainhealth.customer.service.IRoomChatRecordService;

/**
 * AI聊天记录Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-11-01
 */
@Service
public class RoomChatRecordServiceImpl implements IRoomChatRecordService 
{
    @Autowired
    private RoomChatRecordMapper roomChatRecordMapper;

    /**
     * 查询AI聊天记录
     * 
     * @param id AI聊天记录主键
     * @return AI聊天记录
     */
    @Override
    public RoomChatRecord selectRoomChatRecordById(Long id)
    {
        return roomChatRecordMapper.selectRoomChatRecordById(id);
    }

    @Override
    public List<Long> selectChatPacketIdList(Long customerId) {
        return roomChatRecordMapper.selectChatPacketIdList(customerId);
    }

    /**
     * 查询AI聊天记录列表
     * 
     * @param roomChatRecord AI聊天记录
     * @return AI聊天记录
     */
    @Override
    public List<RoomChatRecord> selectRoomChatRecordList(RoomChatRecord roomChatRecord)
    {
        return roomChatRecordMapper.selectRoomChatRecordList(roomChatRecord);
    }

    @Override
    public Long selectRoomChatTokens(RoomChatRecord roomChatRecord) {
        return roomChatRecordMapper.selectRoomChatTokens(roomChatRecord);
    }

    @Override
    public int batchInsertRoomChatRecord(List<RoomChatRecord> roomChatRecordList) {
        return roomChatRecordMapper.batchInsertRoomChatRecord(roomChatRecordList);
    }

    /**
     * 新增AI聊天记录
     * 
     * @param roomChatRecord AI聊天记录
     * @return 结果
     */
    @Override
    public int insertRoomChatRecord(RoomChatRecord roomChatRecord)
    {
        roomChatRecord.setCreateTime(DateUtils.getNowDate());
        return roomChatRecordMapper.insertRoomChatRecord(roomChatRecord);
    }

    /**
     * 修改AI聊天记录
     * 
     * @param roomChatRecord AI聊天记录
     * @return 结果
     */
    @Override
    public int updateRoomChatRecord(RoomChatRecord roomChatRecord)
    {
        roomChatRecord.setUpdateTime(DateUtils.getNowDate());
        return roomChatRecordMapper.updateRoomChatRecord(roomChatRecord);
    }

    /**
     * 批量删除AI聊天记录
     * 
     * @param ids 需要删除的AI聊天记录主键
     * @return 结果
     */
    @Override
    public int deleteRoomChatRecordByIds(Long[] ids)
    {
        return roomChatRecordMapper.deleteRoomChatRecordByIds(ids);
    }

    /**
     * 删除AI聊天记录信息
     * 
     * @param id AI聊天记录主键
     * @return 结果
     */
    @Override
    public int deleteRoomChatRecordById(Long id)
    {
        return roomChatRecordMapper.deleteRoomChatRecordById(id);
    }
}
